package com.hibiscusking.basic.listener;

import com.hibiscusking.basic.service.IPermissionScanService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class PermissionScanInitInstener implements CommandLineRunner {

    @Autowired
    private IPermissionScanService permissionScanService;

    @Override
    public void run(String... args) throws Exception {
        new Thread(new Runnable() {
            @Override
            public void run() {
                log.info("contextInitialized start...");
                // 执行permission数据添加方法
                permissionScanService.scanPermission();
                log.info("contextInitialized stop...");
            }
        }).start();

    }
}
